<?php
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.modeladmin');
class LinkModelLink extends JModelAdmin{
	protected function allowEdit($data = array(), $key = 'id'){

		return JFactory::getUser()->authorise('core.edit', 'com_link.message.'.((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
	}
	public function getTable($type = 'Link', $prefix = 'LinkTable', $config = array()) 
	{
		return JTable::getInstance($type, $prefix, $config);
	}
	
	public function getForm($data = array(), $loadData = true) 
	{
		
		$form = $this->loadForm('com_link.link', 'link', array('control' => 'jform', 'load_data' => $loadData));
		if (empty($form)) 
		{
			return false;
		}
		return $form;
	}
	
	public function getScript() 
	{
		return 'administrator/components/com_link/models/forms/link.js';
	}
	
	
	protected function loadFormData() 
	{
		
		$data = JFactory::getApplication()->getUserState('com_link.edit.link.data', array());
		if (empty($data)) 
		{
			$data = $this->getItem();
		}
		return $data;
	}
	public function getItem($pk = null)
	{
		$item = parent::getItem($pk);
		
		
		return $item;
	}
	protected function prepareTable($table)
	{
		
	}
}
